import request from '../utils/request'

export const orderApi = {
  // 获取订单列表
  getOrders(params = {}) {
    return request.get('/orders', { params })
  },
  
  // 根据ID获取订单详情
  getOrderById(id) {
    return request.get(`/orders/${id}`)
  },
  
  // 创建订单
  createOrder(orderData) {
    return request.post('/orders', orderData)
  },
  
  // 更新订单状态
  updateOrderStatus(id, status) {
    return request.put(`/orders/${id}/status`, { status })
  },
  
  // 取消订单
  cancelOrder(id) {
    return request.put(`/orders/${id}/cancel`)
  }
}

export default orderApi
